package four.model;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * bean的字段名字和json的字段名字不一致时
 *
 * @author wangpp
 * @JsonProperty
 */
public class MyBean {
    //用于字段
    @JsonProperty( "name" )
    private String _name;

    private int _age;

    private String _address;

    //用于getter
    @JsonProperty( "age" )
    public int get_age() {
        return _age;
    }

    //用于setter
    @JsonProperty( "address" )
    public void set_address(String _address) {
        this._address = _address;
    }


    public void set_age(int _age) {
        this._age = _age;
    }

    public String get_name() {
        return _name;
    }

    public void set_name(String _name) {
        this._name = _name;
    }

    public String get_address() {
        return _address;
    }


    @Override
    public String toString() {
        return "MyBean{" +
                "_name='" + _name + '\'' +
                ", _age=" + _age +
                ", _address='" + _address + '\'' +
                '}';
    }
}
